package org.the.gsdo.server;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Profile;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

@Component
@Lazy(true)
@Scope("request")
@Profile( { "dev", "test" } )
public class GreetingManagerRest extends GreetingManagerBase implements GreetingManager {

	// AOP
	public GreetingManagerRest() {
		this(null);
	}

	@Autowired
	public GreetingManagerRest(@Qualifier("version") String version) {
		super(version);
	}

	@Override
	@Transactional(readOnly=false)
	@LogAction("GreetingManagerRest.greetServer")
	public String greetServer(String input, String serverInfo, String userAgent)
			throws IllegalArgumentException {
		// funny side effects if I would write
		// super.greetServer and super would implement greetServer like this class
		// proxy > greetServer
		// this > greetServer
		// super > greetServer (I think)
		//
		// nonono ... it the profile
		// I think compile time weaving is not aware of profiles
		return greetServerX(input, serverInfo, userAgent);
	}

}
